Geosoft Grid File Format

GEOSOFT grid files (version 2 format) are made up of straight binary data. The data has two logical components:

1. 512 byte header.

2. grid (image) data

Header Description

The first 512 contiguous bytes of the file comprise the header. This is made up of a combination of 4-byte signed integers and 8-byte double precision floating point values. The floating point values must conform to IEEE standard storage format in order to be 100% GEOSOFT compatible, although sometimes this is system dependent.

The header parameters are divided into logical information groups. The Data Storage, Geographic Information and Data Scaling parameters are compulsory. These are followed by a set of optional parameters that describe the grid image in more detail, and then an undefined area which is left to be defined by an application suite for its own use.

Parameter

Description

Type Byte, binary
Band R, G, B
Dummy

Dummy colour (pick one of RGB). This option is useful creating transparent images.

Pixel

No interpolation. This option is used to ‘pixelate’ the image, eliminating any interpolation between survey points to allow you to see the edges of the survey points.

Data Storage

These parameters describe the way in which the grid data is stored and the size of the data.

Offset Length Type Name

Description

0 4 long ES Grid data element size: 1 (byte), 2 (short), 4 (float or long), or 8 (double) bytes. If the data is compressed 0x400 is added to this value.
4 4 long SF

sign flag:

0 unsigned

1 signed

2 float (4 and 8 byte only)

*3 colour grid (RGB) (4 byte only)

8 4 long NE

Number of elements per vector

12 4 long NV Number of vectors
16 4 long KX

First element corner and vector storage sense:

±1 first element at bottom left

±2 first element at upper left

±3 first element at upper right

±4 first element at bottom right

If positive, vectors are stored in a right-handed sense; if negative, left handed.

Initially the format was designed to only support grids that have a KX of (+/-) 1. Support for the other possibilities was never implemented by the Geosoft libraries and will probably never be.

Geographic Information

These parameters locate the grid geographically. It is up to the application to define the geographic reference system to which these parameters refer. Normally some ground reference system (such as UTM) is used.

 

Offset Length Type Name

Description

20 8 double DE The distance between consecutive points of each vector, expressed in reference system units.
28 8 double DV

The distance between consecutive vectors, expressed in reference system units.

36 8 double X0

The X location of the grid origin expressed in the standard reference system units. The origin is always the bottom left corner of the grid (the first element if KX=û1).

When a grid is displayed in Oasis montaj the grid "cell" is centred on the grid node. Thus the actual cell displayed on the screen will extend ½ cell to the west and ½ cell to the south of the grid origin.

44 8 double Y0

The Y location of the grid origin expressed in the standard reference system units. The origin is always the bottom left corner of the grid (the first element if KX=û1).

52 8 double ROT

The grid axis rotation, in degrees counter clockwise, relative to the co-ordinate system axis.

Data (Z) Scaling

The scaling parameters describe the relationship between the numbers stored in the grid file and the floating point numbers they represent. Given ZBASE and ZMULT, the floating point and stored values are related as follows:

stored value = ( real value - ZBASE ) * ZMULT

floating point value = ( stored value / ZMULT ) + ZBASE

Offset Length Type Name

Description

60 8 double ZBASE

base value removed

68 8 double ZMULT data was multiplied by ZMULT

Optional Parameters:

The following parameters are optional and may or may not be set by an application. If an application does not use a parameter, it must insure that the parameter is set to the non-valid dummy value (see below) appropriate for that data type. The text strings, if un-used, may be left blank. Further, if an application modifies a grid in such a way that one of the optional parameters would no longer be valid, that application must either re-set that parameter to its new value, or set it to its non-valid dummy value. The non-valid dummy values for each data type are defined in section 3.

Offset Length Type Name

Description

76 48 ASCII LABEL

grid label (text)

124 16 ASCII MAPNO

map number designation (text)

140 4 long PROJ

map projection reference

144 4 long UNITX

X distance units

148 4 long UNITY

Y distance units

152 4 long UNITZ

Z distance units

156 4 long NVPTS

number of valid points in grid

160 4 long/float IZMIN

minimum grid value

164 4 long/float IZMAX

Maximum grid value

168 4 long/float IZMED grid median value
172 4 long/float IZMEA

grid mean

176 8 double ZVAR

Variance

184 4 long PRCS process flag

Undefined Application Parameters:

The remaining 324 bytes of the header (to fill out to 512 bytes) may be defined and used by data specific applications. All general-purpose applications will either leave the USER area undefined, or pass the area from grid-to-grid unchanged.

Offset Length Type Name

Description

188 324 ? USER

undefined application specific information.

Uncompressed Grid (Image) Data

The actual gridded data may be stored as any one of the following, as specified by the ES parameter in the header:

ES=1: 1-byte

unsigned 0 to 254

signed -126 to 127

ES=2: 2-byte

Unsigned 0 to 65534

signed -32766 to 32767

ES=4:
long
4-byte

Unsigned 0 to 4294967294

signed –2147483646 to 2147483647

ES=4/8:
floating point
4-byte
8-byte

-0.9E+32 to 1E+30

The SF (sign flag) indicates whether the data is signed, unsigned or float (only 4-byte and 8-byte data are floating point).

The data is stored as NV fixed length vectors. A vector is a collection of consecutive elements, each representing a point located a distance DE from the previous point. Each consecutive vector is parallel to, and separated from the previous vector by a distance DV.

The first vector begins immediately following the grid header, and the first element represents the corner of the grid as specified by the KX parameter. The location of each consecutive element and each consecutive vector is defined by the KX, X0, Y0 and ROT parameters as illustrated in figure 1.

The length of each vector in bytes is ES * NE. The total file length will always be at least:

512 + (ES * NE * NV) bytes

Actual grid files may be longer depending on the blocking factor used by the software that created the grids. In the case of compressed grids the size of the file will vary depending on the nature of the dats.

Compressed Grid (Image) Data

Compressed grid data starts with the following 16-bit header immediately following the grid header:

Offset Length Type Name

Description

0 4 long SIG

The compression signature: 0xF8E7D8C7

4 4 long COMP_TYPE

Compression type:

0 unsigned

1 simple (best size) ZLIB

2 low (fast) LZRW1

8 4 long NB

Number of blocks

12 4 long VPB

Number of vectors per block

A block size of 65536 uncompressed bytes is used if the bytes required for a one or more vectors will fit into it. Otherwise every uncompressed block will be as big as a single vector and the number of blocks will be equal to the number of vectors. The unused elements in every block are initialized to the non-valid dummy values described below before compression. This table is followed by two tables (each NB in length; see table above) of numbers describing the offset of the compressed blocks from the start of the file and the size of the compressed data in the block found at that position. The table is as follows:

Offset Length Type Name

Description

0 NB*8 64bit long OB

File offset from start of every block

NB*8 NB*4 long CBS

Compressed size of every block

Non-valid Dummy Values

1-byte signed dummy = -127

1-byte unsigned dummy = 255

2-byte signed dummy = -32767 (minimum 2-byte integer)

2-byte unsigned dummy = 65535

4-byte signed dummy = -2147483647 (minimum 4-byte integer)

4-byte unsigned dummy = 4294967295

4-byte floating point dummy = -1.0E+32

8-byte double precision floating point dummy = -1.0E+32

See Also:

 

Access MySeequent >> for online support and learning resources: Knowledge Base Articles, Guided Learning Path Lessons, Instructional Videos, Technical and Technology Papers, and Best Practices.